 const {query}=require('./query.js')
 module.exports= class publicClass {
	constructor(req,res,neth) {
		this.req=req
		this.res=res
		this.neth=neth
		this.sendform=res.sendform
		this.query=query
	}
	// 公共方法 用于解密token
	regtoken(){
		try{
			if(!this.req.headers.token)return this.sendform(0,'未登录')
			const {Verifytoken}= require('../module/Token.js')
			let data=Verifytoken(this.req.headers.token)
			if(data.code==0)return this.sendform(0,'无效token')
			if(this.onload) return this.onload(data.data)
			return data.data
		}catch(err){
			this.neth(err.message)
		}
	}
}